<?php
function htmlspec($src) {
	return htmlspecialchars($src, ENT_COMPAT, 'UTF-8');
}

function date_part($str_datetime) {
	if(is_null($str_datetime) || $str_datetime == '') {
		return 'n/a';
	}
	$dp = date_parse($str_datetime);
	return $dp['year'] . '-' . $dp['month'] . '-' . $dp['day'];
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ADMIN Users - nirvana 0.8</title>
<link rel="shortcut icon" href="<?php echo(base_url()); ?>img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="<?php echo(base_url()); ?>css/admin.css" />
</head>
<body id="pgUsers">
<div id="wrapper">
	<!-- header -->
	<?php include('common_header.php'); ?>
	<!-- /header -->
	
	<div id="koerper">
		<div id="main">
			<p>Total: <?php echo($total_num); ?> | Showing: <?php echo($showing_num); ?> | Hiding: <?php echo($hiding_num); ?></p>
			<table id="userList" cellspacing="1">
				<tr>
					<th>ID</th>
					<th>User-Name</th>
					<th>URL</th>
					<th>Blog-Title</th>
					<th>Pwd</th>
					<th>LUD</th>
					<th>Operations</th>
				</tr>
				<?php foreach($users as $u) { ?>
				<tr<?php if($u->show == 0) { ?> class="hiding"<?php } ?>>
					<td><?php echo($u->id); ?></td>
					<td><?php echo(htmlspec($u->user_name)); ?></td>
					<td><?php if($u->user_url != '') { echo($u->user_url); } else { ?><a class="btn" href="/admin/set_user_url/<?php echo($u->id); ?>">Set</a><?php } ?></td>
					<td><?php echo(htmlspec($u->title)); ?></td>
					<td><a target="_blank" href="/admin/reset_pwd/<?php echo($u->id); ?>" class="btn" onclick="return confirm('Are u sure?');">Reset</a></td>
					<td><?php echo(date_part($u->last_update_time)); ?></td>
					<td><a href="/admin/show_hide/<?php echo($u->id); ?>/<?php echo($u->show); ?>" class="btn">S/H</a></td>
				</tr>
				<?php } ?>
			</table>
		</div><!-- /main -->
	</div><!-- /koeper -->
	
	<!-- footer -->
	<?php include('common_footer.php'); ?>
	<!-- /footer -->
</div><!-- /wrapper -->
</body>
</html>
